import request from '@/utils/request';
import moment from 'moment'

// 导入
export function upload(data) {
  return request('/uploadAndDownload/upload', {
    method: 'POST',
    data
  });
}

// 添加或修改遗失物品信息
export function addUpdateLostArticlesInfo (data) {
  if (!data.flightDate) {
    delete data.flightDate
  } else {
    data.flightDate = moment(data.flightDate).format('YYYY-MM-DD 00:00:00')
  }

  return request('/luggage/lost/articles/addUpdateLostArticlesInfo', {
    method: 'POST',
    data
  });
}

// 遗失物品详情
export function lostArticlesDetails (params) {
  return request('/luggage/lost/articles/lostArticlesDetails', {
    method: 'get',
    params
  });
}

// 获取当前登录人工作航站下的所有工作人员姓名
export function getTuCnameByCity3Code () {
  return request('/luggage/lost/articles/getTuCnameByCity3Code', {
    method: 'get'
  });
}

// 获取业务的图片地址
export function getImgByRelevance (params) {
  return request('/luggage/lost/img/getImgByRelevance', {
    method: 'get',
    params
  });
}

// 批量修改图片
export function batchUpdateImg (data) {
  return request('/luggage/lost/img/batchUpdateImg', {
    method: 'post',
    data
  });
}

// PC端获取事故单完整详情
export async function getPkgAccidentDetail(params) {
  return request('/luggage/pkg/getPkgAccidentDetail', {
    method: 'get',
    params,
  })
}

// 多收转遗失
export function turnToLost (data) {
  return request('/luggage/pkg/overcharge/turnToLost', {
    method: 'post',
    data
  });
}
